<template>
    <view class="page-wallet-withdraw-records">
		<view class="p-4" v-if="longList.list.length == 0">
            <u-empty text="暂无记录" mode="list"></u-empty>
    	</view>
		<u-cell-group v-else>
			<u-cell-item v-for="(item,index) in longList.list" :key="index"  :arrow="false">
				<template slot="title">
					<!-- <u-icon :class="item.type == '0' ? 'c-red' : 'c-cyan'" :name="item.type == '0' ? 'arrow-upward' : 'arrow-downward'"></u-icon> -->
					
					<view>
						<text class="unit" :class="item.type == '0' ? 'c-red' : 'c-cyan'">￥</text>
						<text class="price mr-2" :class="item.type == '0' ? 'c-red' : 'c-cyan'">{{ item.amount }}</text>
					</view>
					<view class="ft-12">
						<u-icon name="account-fill"></u-icon><text class="ml-2">{{ item.nickname }}</text>
						<text>，{{ item.billName }}</text>
					</view>
				</template>
				<view>
					<text class="ft-12">{{proxy.$util.setName(item.feeType, optionData.feeType)}}</text>
					<view class="ft-12">{{ item.createTime }}</view>
				</view>
			</u-cell-item>
		</u-cell-group>
    </view>
</template>
<script setup lang="ts">
import {onShow, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app';
import { useLonglist } from '@/static/fn/longList';
const {proxy} = getCurrentInstance() as ComponentInternalInstance;
import { useOptionData } from '@/stores/optionData';
const optionDataStore = useOptionData();
const initObj = {
	listApi:'/admin/userBalanceRec/getUserBalanceRec',
	// resKey: 'data',
}
let { searchForm, longList, getList} = useLonglist(initObj);
const optionData = reactive({});
const getInitData = async () => {
  optionData.feeType = await optionDataStore.getDictList('fee_type');
}
onPullDownRefresh(() => {
	getList('refresh');
	setTimeout( () => {
		uni.stopPullDownRefresh();
	}, 1000);
});
onReachBottom(() =>{
	getList();
});
onShow(() => {
	getInitData();
	getList('refresh');
})
</script>